﻿----------------------------------------------------------------------------------------------------
--
--  © 2012 Stanislav S. Yarmonov.
--
--  TODO:LICENSE
--     
----------------------------------------------------------------------------------------------------
IF OBJECT_ID(N'[_DB].[Schema_Drop]', 'P') IS NOT NULL
	DROP PROCEDURE [_DB].[Schema_Drop]
GO

----------------------------------------------------------------------------------------------------
--
--  Schema dropping routine.
--
--  INPUT
--		@@Name
--		Name of the schema to be dropped.
--
----------------------------------------------------------------------------------------------------
CREATE PROCEDURE [_DB].[Schema_Drop]
	@@Name [sysname]
AS
SET NOCOUNT ON

IF [_DB].[Schema_Exists](@@Name) = 1 BEGIN
	DECLARE @SQL [nvarchar](max) SELECT @SQL =
		N'DROP SCHEMA ' + QUOTENAME(@@Name)
	
	EXECUTE(@SQL)
END
GO

